package com.kkk.shop.goods.pojo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.kkk.shop.user.pojo.AAdmins;

/**
 * 商品分类的POJO
 * 
 * @author kkk
 *
 */
public class AGoodsCate
{
	private int id;
	private int adminsId;
	private int parentId;
	private String name;
	private String url;
	private String spec;
	private String content;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;
	
	/* 关联关系 */
	private AAdmins admins ; 
	private AGoodsCate parentCate ; 
	private List<AGoodsCate> childCateList = new ArrayList<AGoodsCate>();
	
	/* 字符串描述 */
	private String statusStr ; 
	/* |-->家电
	 * |-->|-->电视
	 * |-->|-->|-->国产品牌 */
	private String treeName ; 

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public int getAdminsId()
	{
		return adminsId;
	}

	public void setAdminsId(int adminsId)
	{
		this.adminsId = adminsId;
	}

	public int getParentId()
	{
		return parentId;
	}

	public void setParentId(int parentId)
	{
		this.parentId = parentId;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getUrl()
	{
		return url;
	}

	public void setUrl(String url)
	{
		this.url = url;
	}

	public String getSpec()
	{
		return spec;
	}

	public void setSpec(String spec)
	{
		this.spec = spec;
	}

	public String getContent()
	{
		return content;
	}

	public void setContent(String content)
	{
		this.content = content;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getPubTime()
	{
		return pubTime;
	}

	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}

	public AAdmins getAdmins()
	{
		return admins;
	}

	public void setAdmins(AAdmins admins)
	{
		this.admins = admins;
	}

	public AGoodsCate getParentCate()
	{
		return parentCate;
	}

	public void setParentCate(AGoodsCate parentCate)
	{
		this.parentCate = parentCate;
	}

	public String getStatusStr()
	{
		/*
		 * 状态:0:禁用;1:启用
		 */
		AGoodsCateEnum[] goodsCateEnums = AGoodsCateEnum.values();
		for (int i = 0; i < goodsCateEnums.length; i++)
		{
			AGoodsCateEnum goodsCateEnum = goodsCateEnums[i];
			if (goodsCateEnum.toString().startsWith("STATUS_"))
			{
				/* 如果循环的枚举==数据库存储的状态值,赋值枚举指定的字符串 */
				if (goodsCateEnum.getStatus() == this.status)
				{
					this.statusStr = goodsCateEnum.getInfo();
					break;
				}
			}
		}
		return statusStr;
	}

	public List<AGoodsCate> getChildCateList()
	{
		return childCateList;
	}

	public void setChildCateList(List<AGoodsCate> childCateList)
	{
		this.childCateList = childCateList;
	}

	public String getTreeName()
	{
		return treeName;
	}

	public void setTreeName(String treeName)
	{
		this.treeName = treeName;
	}
}
